<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <com-headd></com-headd>
    </div>
    <script src="./vue.js"></script>
    <script>
        const Child={
            template:`
                <input type='text'>
            `,

            activated(){
                console.log('acrived')
            },
            deactivated(){
                console.log('deactivated')
            }
        }
        const ComHeadd={
            template:`
                <div>
                    <div>我是全局组件</div>
                    <button @click='boo=!boo'>按钮</button>
                    <keep-alive>
                        <child v-if='boo'></child>
                    </keep-alive>
                </div>
            `,
            components:{
                Child
            },
            data(){
                return{
                    boo:true
                }
            }
        }
        Vue.component('ComHeadd',ComHeadd)
        const vm =new Vue({
            el:'#app'
        })
    </script>
</body>
</html>